<!DOCTYPE html>
<html="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>index</title>
    <script src="https://cdn.bootcss.com/socket.io/2.0.4/socket.io.slim.js"></script>
</head>

<body>
<div id="message"></div>
<div id="thenews">news...</div>
<div>当前在线人数
    <span id="count">0</span>
</div>
<input type="text" id="input">
<ol id="msg"></ol>
<script src="https://cdn.socket.io/stable/socket.io.js"></script>
<script>
    // socket.io引入成功后，可通过io()生成客户端所需的socket对象。

     let socket = io('http://127.0.0.1:9091/', {transports:['websocket','xhr-polling','jsonp-polling']});

    // socket.emmit()用户客户端向服务端发送消息，服务端与之对应的是socket.on()来接收信息。
    socket.emit('loginOrgganId', {orgganId:'hi, server',loginUid:'123'});

    socket.on('connectsuccess',  (data)=>{
        console.log(data);
    });
    socket.on('success',  (data)=>{
        console.log(data);
    });


    // socket.on()用于接收服务端发来的消息
    socket.on('connect',  ()=>{
        console.log('client connect server');
    });
    socket.on('disconnect', ()=>{
        console.log('client disconnect');
    });
</script>

/
</body>

</html>